import ButtonGroupEdit from '@/components/common/ButtonGroupEdit/ButtonGroupEdit.vue'

export const createColumns = (vm) => [
  {
    title: '',
    width: 34,
    align: 'center',
    type: 'selection',
  },
  {
    title: '序号',
    key: 'id',
    align: 'center',
    width: 80,
    render(h, params) {
      return <div>{(vm.formData.pageNo - 1) * vm.formData.pageSize + params.index + 1}</div>
    },
  },
  /*   { title: '反馈单位', key: '', align: 'center' },
  { title: '作品数量', key: '', align: 'center', sortable: 'custom', sortType: 'desc' },
  { title: '阅读量', key: '', align: 'center', sortable: 'custom' },
  { title: '播放量', key: '', align: 'center', sortable: 'custom' },
  { title: '点赞量', key: '', align: 'center', sortable: 'custom' },
  { title: '评论量', key: '', align: 'center', sortable: 'custom' },
  { title: '转发量', key: '', align: 'center', sortable: 'custom' }, */
  {
    title: '操作',
    align: 'center',
    width: 150,
    render(h, params) {
      return (
        <div>
          <ButtonGroupEdit
            edit={params.row.editable}
            on-change={(val) => (params.row.editable = val)}
            on-on-cancel={() => {}}
            on-on-complete={() => vm.handleEditTableRow(params.row)}
          ></ButtonGroupEdit>

          <poptip confirm transfer title="确定删除?" on-on-ok={() => vm.handleDeleteTableRow(params.row)}>
            <icon-button
              icon="delete_active"
              title="删除"
              class="ml14"
              width="26"
              height="26"
              style="vertical-align: sub"
              activated={false}
            ></icon-button>
          </poptip>
        </div>
      )
    },
  },
]
